<style>
    .th-markdown #a-top{
        padding-bottom: 20px;
        padding-top: 10px;
    }
    .th-markdown #a-top input{
        margin-bottom: 20px;
    }
    #a-tags_tagsinput{
        min-height: 20px !important;
        height: 36px !important;
    }
    .tag:after{
        display: none !important;
    }
    #a-tags_addTag input{
        margin-bottom: 0 !important;
    }
</style>
<h3>编辑文章</h3>
<div class="x_panel">
    <div class="x_content">
        <div class="th-markdown" id="article">
            <span hidden id="error-msg">${msg!}</span>
            <form id="mdform" method="post" action="/admin/articles">
                <input hidden type="text" name="type" id="submitType">
                <input hidden type="text" name="id" value="${article.id}">
                <div id="a-top">
                    <div class="row">
                        <div class="col-md-4">
                            <input name="title" id="title" value="${article.title!}" required="required" class="form-control col-xs-12" placeholder="文章标题">
                        </div>
                        <div class="col-md-4">
                            <input name="subpath" id="subpath" value="${article.subpath!}" class="form-control col-xs-12" placeholder="访问地址 如 'article1' ,默认为文章编号">
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-md-4">
                            <input name="tags" id="a-tags" type="text" class="tags form-control" value="${article.tags!}" />
                            <div id="suggestions-container" style="position: relative; float: left; width: 250px; "></div>
                        </div>
                        <div class="col-md-4">
                            <select id="a-categories" name="categories" type="text" class="kind form-control col-xs-12">
                                <% for(kind in kinds){%>
                                    <%
                                        var optionSelected = "";
                                        if(kind.id == str_to_int(article.categories)){
                                            optionSelected = "selected";
                                        }
                                    %>
                                    <option ${optionSelected!} value="${kind.id!}">${kind.name!}</option>
                                <%}%>
                            </select>
                        </div>
                    </div>
                </div>
                <div id="a-center">
                    <textarea name="content" id="editor">${article.content!}</textarea>
                    <textarea name="contentHtml" hidden id="editorHtml"></textarea>
                </div>
                <div id="a-bottom">
                    <div class="row">
                        <div class="col-md-8">
                            <div class="">
                                <label>
                                    <%
                                        var canCommont = "";
                                        if(is("on",article.usecommont)){
                                            canCommont = "checked";
                                        }else{
                                            canCommont = "";
                                        }
                                    %>
                                    <input id="usecommont" name="usecommont" type="checkbox" value="${article.usecommont!}" ${canCommont!} class="js-switch" /> 允许评论
                                </label>
                            </div>
                        </div>
                        <div class="col-md-4" style="text-align: right;">
                            <input class="btn btn-success" type="button" id="save_publish" value="保存并发布">
                            <input class="btn btn-warning" type="button" id="save" value="保存为草稿">
                        </div>
                    </div>
                </div>
                <div style="height: 60px;"></div>
                <div class="clearfix"></div>
            </form>
        </div>
    </div>
</div>